package com.woniu.mapper;

import com.woniu.entity.Permission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author FQY
* @description 针对表【permission(权限)】的数据库操作Mapper
* @createDate 2025-11-05 11:38:29
* @Entity com.woniu.entity.Permission
*/
public interface PermissionMapper {

    Integer deleteByPrimaryKey(Integer id);

    Integer insert(Permission record);

    Integer insertSelective(Permission record);

    Permission selectByPrimaryKey(Integer id);

    Integer updateByPrimaryKeySelective(Permission record);

    Integer updateByPrimaryKey(Permission record);


    List<Permission> selectPermissionsByStaffId(@Param("staffId") Integer staffId);
    //检查员工是否有某个权限
    Integer checkUserPermission(@Param("staffId") Integer staffId, @Param("permCode") String permCode);
    //根据角色ID查询权限
    List<Permission> selectPermissionsByRoleId(@Param("roleId") Integer roleId);
    //查询所有权限
    List<Permission> selectAllPermissions();
    //根据权限码查询权限
    Permission selectByPermCode(@Param("permCode") String permCode);
    // 删除角色所有权限
    Integer deleteRolePermissions(@Param("roleId") Integer roleId);
    // 批量插入角色权限
    Integer insertRolePermissions(@Param("roleId") Integer roleId, @Param("permissionIds") List<Integer> permissionIds);

}
